﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace bezeq_online_work.view
{
    public partial class req_1_form : Form
    {
        CONTROL.BusinessLogic controler;

        public req_1_form(CONTROL.BusinessLogic d)
        {
            InitializeComponent();
            controler = d;
            try
            {
                label12.Text = " במקום עבודתך מותר לסמן עד" + controler.workerBlocksCount() + " בקשות* ";

            }
            catch (Exception ex)
            {
                // throw error message
                MessageBox.Show("an error has occurred. contact your administrator for further assistance " + ex.Message);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            view.mainmenu_ t = new mainmenu_(controler);
            t.Show();
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            int countChecked = 0;
            bool[] array = new bool[14];
            array[0] = s11.Checked; array[1] = s12.Checked;
            array[2] = s21.Checked; array[3] = s22.Checked;
            array[4] = s31.Checked; array[5] = s32.Checked;
            array[6] = s41.Checked; array[7] = s42.Checked;
            array[8] = s51.Checked; array[9] = s52.Checked;
            array[10] = s61.Checked; array[11] = s62.Checked;
            array[12] = s71.Checked; array[13] = s72.Checked;

            for (int i = 0; i < 14; i++)
            { if (array[i]) { countChecked++; } }

            try
            {
                if (countChecked > controler.BlocksCountInt())
                { MessageBox.Show("סומנו יותר בקשות מהמותר אנה סמן לפי המספר המותר של בקשות לפי הגדרות המוקד בו הינך עובד."); }
                else
                {

                    controler.addBlockRequest(array, InfotextBox.Text);
                    MessageBox.Show("בקשות שיבוצים נקלטו בהצלחה.");
                }
            }
            catch (Exception ex)
            {
                // throw error message
                MessageBox.Show("an error has occurred. contact your administrator for further assistance " + ex.Message);
            }
           
        }
    }
}
